package com.spring.boot.service;

import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;

public interface BaseService {

	public default <T> T queryNullAble(JdbcTemplate jdbc, String sql, RowMapper<T> rowMapper) {
		try {
			return (T) jdbc.queryForObject(sql, rowMapper);
		} catch (EmptyResultDataAccessException e) {
			return null;
		}
	}
}
